// pages/templates/couponli/couponli.js
import Router from '../../../utils/router.js';
import base from '../../../config/base.js';
Component({
  properties: {
    closes: {
      type: Boolean,
      value: {}
    },
    newsList: {
      type: Object
    }
  },
  data: {
    closes: false,
    icon_coupon_ky: base.static + 'my/coupon_ky.png',
    icon_news_quan: base.static + 'store/news-quan.png',
    newsList: '',
  },
  ready() {
    let that = this;
    let properties = this.properties;
    that.setData({
      closes: properties.closes,
      newsList: properties.newsList
    })
  },
  methods: {
    //关闭大礼包弹窗
    closex: function(e) {
      this.setData({
        closes: false
      })
    },
    //领取红包
    receive: function() {
      let _this = this;
      _this.setData({
        closes: false
      })
      Router.go('newman');
    },
    //判断是否是新用户
    newUser: function() {
      let _this = this;
      let params = {
        type: 'check_newpeoplecoupon'
      }
      service.receiveaj(params, function(res) {
        if (res.code == 1) {
          _this.setData({
            closes: true
          })
        } else if (res.code == 0) {
          _this.setData({
            closes: false
          })
        }
      });
    },
    goMyCoupon: function(){
      let _this = this;
      Router.go('mycoupon');
      _this.setData({
        closes: false
      })
    },

  }


})